<template>
	<view class="container">
		<view class="blue-bg"></view>
		<view class="content">
			<view class="detail-card">
				<view class="title">{{detail.title}}</view>
				<view class="sub-info">
					<text class="industry">{{detail.industry}}</text>
					<text class="date">{{detail.date}}</text>
				</view>
				<view class="image-wrapper">
					<image class="banner" :src="detail.image" mode="aspectFill"></image>
				</view>
				<view class="description">{{detail.description}}</view>
			</view>
			
			<view class="info-card">
				<view class="price-info">
					<text>价格：</text>
					<text class="current-price">¥{{detail.currentPrice}}</text>
					<text class="original-price">原价：¥{{detail.originalPrice}}</text>
				</view>
				<view class="date-info">
					<text>活动截止日期：{{detail.endDate}}</text>
				</view>
				<view class="phone-info">
					<text>咨询电话：</text>
					<text class="phone" @click="makeCall">{{detail.phone}}</text>
				</view>
				<view class="notice">
					<text>注意事项：{{detail.notice || '暂无'}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			detail: {
				title: '',
				industry: '',
				date: '',
				image: '',
				description: '',
				currentPrice: '',
				originalPrice: '',
				endDate: '',
				phone: '',
				notice: '暂无'
			}
		}
	},
	onLoad(options) {
		if (options.params) {
			try {
				// 解析传递的数据
				const activityData = JSON.parse(decodeURIComponent(options.params))
				// 更新详情数据
				this.detail = {
					...this.detail,
					...activityData
				}
			} catch (err) {
				uni.showToast({
					title: '数据加载失败',
					icon: 'none'
				})
			}
		}
	},
	methods: {
		makeCall() {
			uni.makePhoneCall({
				phoneNumber: this.detail.phone
			})
		}
	}
}
</script>

<style>
.container {
	min-height: 100vh;
	background: #F7F7F7;
}

.blue-bg {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 360rpx;
	background-color: #2979ff;
}

.content {
	position: relative;
	z-index: 1;
	padding: 20rpx;
}

.detail-card, .info-card {
	background: #FFFFFF;
	border-radius: 12rpx;
	padding: 20rpx;
	margin-bottom: 20rpx;
}

.title {
	font-size: 32rpx;
	color: #333;
	text-align: center;
	margin-bottom: 16rpx;
}

.sub-info {
	display: flex;
	justify-content: space-between;
	color: #999;
	font-size: 24rpx;
	margin-bottom: 20rpx;
}

.image-wrapper {
	padding: 0 20rpx;
	margin-bottom: 20rpx;
}

.banner {
	width: 100%;
	height: 320rpx;
	border-radius: 8rpx;
}

.description {
	font-size: 28rpx;
	color: #333;
	line-height: 1.6;
}

.info-card {
	font-size: 28rpx;
	color: #333;
}

.price-info, .date-info, .phone-info, .notice {
	margin-bottom: 16rpx;
}

.current-price {
	color: #FF5B05;
	font-size: 32rpx;
	font-weight: bold;
	margin: 0 16rpx;
}

.original-price {
	color: #999;
	font-size: 24rpx;
	text-decoration: line-through;
}

.phone {
	color: #2979ff;
}
</style> 